package com.yiqi.lottery.feature.mine.model;

import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.suozhang.framework.entity.bo.PageData;
import com.yiqi.lottery.entity.bo.OrderBo;
import com.yiqi.lottery.entity.bo.OrderListBo;
import com.yiqi.lottery.entity.bo.RegisterBo;
import com.yiqi.lottery.feature.lottery.dependencies.order.DaggerOrderModelComponent;
import com.yiqi.lottery.feature.mine.contract.BindContract;
import com.yiqi.lottery.feature.mine.contract.OrderContract;
import com.yiqi.lottery.feature.mine.dependencies.bind.DaggerBindModelComponent;
import com.yiqi.lottery.framework.api.ApiLib;
import com.yiqi.lottery.framework.api.UserApi;
import io.reactivex.Observable;

import javax.inject.Inject;

public class OrderModel implements OrderContract.Model {

    @Inject
    UserApi api;


    @Inject
    public OrderModel() {

        DaggerOrderModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }


    @Override
    public Observable<PageData<OrderListBo>> getOrderList(int page,int type) {
        return api.getMyOrder(page, type).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<PageData<OrderListBo>> getMyCopurceOrderList(int page) {
        return api.getMycopurceOrder(page).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

}
